﻿// -------------------------------------------------------------------------
//    @FileName         :    NFSnsOnlineRole.cpp
//    @Author           :    gaoyi
//    @Date             :    2025-03-29
//    @Email			:    445267987@qq.com
//    @Module           :    NFSnsOnlineRole
//
// -------------------------------------------------------------------------

#include "NFSnsOnlineRole.h"

#include <NFServerComm/NFServerCommon/NFIServerMessageModule.h>

NFSnsOnlineRole::NFSnsOnlineRole()
{
    if (NFShmMgr::Instance()->GetCreateMode() == EN_OBJ_MODE_INIT)
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFSnsOnlineRole::~NFSnsOnlineRole()
{
}

int NFSnsOnlineRole::CreateInit()
{
    m_roleId = 0;
    m_logicSvrId = 0;
    m_lastLoginTime = 0;
    m_lastLogoutTime = 0;
    return 0;
}

int NFSnsOnlineRole::ResumeInit()
{
    return 0;
}

int NFSnsOnlineRole::Init(uint64_t roleId, int logicSvrId, uint64_t lastLoginTime, uint64_t lastLogoutTime)
{
    m_roleId = roleId;
    m_logicSvrId = logicSvrId;
    m_lastLoginTime = lastLoginTime;
    m_lastLogoutTime = lastLogoutTime;
    return 0;
}

int NFSnsOnlineRole::SendMsgToLogicServer(uint32_t msgId, const google::protobuf::Message& data)
{
    FindModule<NFIServerMessageModule>()->SendMsgToLogicServer(NF_ST_SNS_SERVER, m_logicSvrId, msgId, data,  m_roleId);
    return 0;
}
